﻿using OxyPlot;
using SmartPatientCentre.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartPatientCentre.ViewModels
{
    public class ChartViewModel
    {
        public Chart Sodium { get; private set; }
        public Chart Potassium { get; private set; }
        public Chart Urea { get; private set; }
        public Chart Creatinine { get; private set; }


        public ChartViewModel(ResultsViewModel rvm)
        {
            Chart sc = new SodiumChart(rvm.Sodium);
            Sodium = sc;

            Chart pc = new PotassiumChart(rvm.Potassium);
            Potassium = pc;

            Chart uc = new UreaChart(rvm.Urea);
            Urea = uc;

            Chart cc = new CreatinineChart(rvm.Creatinine, rvm.Patient);
            Creatinine = cc;
        }

        public Chart Select(string resultType)
        {
            switch (resultType)
            {
                case "Sodium":
                    return Sodium;

                case "Potassium":
                    return Potassium;

                case "Urea":
                    return Urea;

                case "Creatinine":
                    return Creatinine;

                default:
                    throw new Exception("Result type not found!");
            }
        }
    }
}
